package com.my.log.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author timo 2021/2/25
 */
@Configuration
@ConditionalOnWebApplication
//@EnableConfigurationProperties({BladeRequestLogProperties.class})
//@BladePropertySource("classpath:/blade-log.yml")
public class LogToolAutoConfiguration {
    public LogToolAutoConfiguration() {
    }

    @Bean
    public ApiLogAspect apiLogAspect() {
        return new ApiLogAspect();
    }

//    @Bean
//    public LogTraceAspect logTraceAspect() {
//        return new LogTraceAspect();
//    }
//
//    @Bean
//    public BladeLogger bladeLogger() {
//        return new BladeLogger();
//    }
//
//    @Bean
//    public FilterRegistrationBean<LogTraceFilter> logTraceFilterRegistration() {
//        FilterRegistrationBean<LogTraceFilter> registration = new FilterRegistrationBean();
//        registration.setDispatcherTypes(DispatcherType.REQUEST, new DispatcherType[0]);
//        registration.setFilter(new LogTraceFilter());
//        registration.addUrlPatterns(new String[]{"/*"});
//        registration.setName("LogTraceFilter");
//        registration.setOrder(2147483647);
//        return registration;
//    }
//
//    @Bean
//    @ConditionalOnMissingBean(
//            name = {"apiLogListener"}
//    )
//    public ApiLogListener apiLogListener(ILogClient logService, ServerInfo serverInfo, BladeProperties bladeProperties) {
//        return new ApiLogListener(logService, serverInfo, bladeProperties);
//    }
//
//    @Bean
//    @ConditionalOnMissingBean(
//            name = {"errorEventListener"}
//    )
//    public ErrorLogListener errorEventListener(ILogClient logService, ServerInfo serverInfo, BladeProperties bladeProperties) {
//        return new ErrorLogListener(logService, serverInfo, bladeProperties);
//    }

}
